#include "RGBA.h"

RGBA::RGBA(){
	value[0] = value[1] = value[2] = value[3] = 0.0f;
}

RGBA::RGBA(float r, float g, float b, float a) {
	value[0] = r;
	value[1] = g;
	value[2] = b;
	value[3] = a;
}

RGBA::RGBA(int hexColor, float alpha){
	setValue(hexColor, alpha);
}

void RGBA::setValue(int hexColor, float alpha) {
	value[0] = (float)(hexColor >> 16 & 255) / 255.0f;
	value[1] = (float)(hexColor >> 8 & 255) / 255.0f;
	value[2] = (float)(hexColor & 255) / 255.0f;
	value[3] = alpha;
}

const float& RGBA::operator[](const int i) const {
	return value[i];
}

float& RGBA::operator[](const int i ) {
	return value[i];
}

RGBA::~RGBA() {}
